/* 
 * This file is part of Boozt Platform
 * and belongs to BZT Fashion AB.
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
var currentImage = 0;

$('.slider .link').live('mouseenter',function(){
    $('.slider .link a').removeClass('active');
    $(this).find('a').addClass('active');
    $('.image').stop(true).scrollTo($('.images li:eq('+$(this).index()+')'),500);
});

$('.bikes a').live('mouseenter',function(){
    $('.image').stop(true).scrollTo($('.images li:eq('+$(this).attr('rel')+')'),500);
});

$('.imageThumbs li').live('click',function(e){
    $('.imageThumbs').stop(true).scrollTo($('.thumbs li:eq('+$(this).index()+')'),500,{offset:-320});
    $('.image').stop(true).scrollTo($('.images li:eq('+$(this).index()+')'),500);
    currentImage = $(this).index();
    e.preventDefault();
});

$('.arrowLeft').live('click',function(e){
    currentImage--;
    if(currentImage<0){
        currentImage = $('.thumbs li').length-1;
    }
    
   $('.imageThumbs').stop(true).scrollTo($('.thumbs li:eq('+currentImage+')'),500,{offset:-320});
   $('.image').stop(true).scrollTo($('.images li:eq('+currentImage+')'),500);
   e.preventDefault();
});

$('.arrowRight').live('click',function(e){
    currentImage++;
    if(currentImage>=$('.thumbs li').length){
        currentImage = 0;
    }
    
   $('.imageThumbs').stop(true).scrollTo($('.thumbs li:eq('+currentImage+')'),500,{offset:-320});
   $('.image').stop(true).scrollTo($('.images li:eq('+currentImage+')'),500);
   e.preventDefault();
});